package Static关键字;

public class static修饰变量 {
    public static void main(String[] args) {
        //静态变量通过类名来访问
        Students.room = "104";
        Students one = new Students("张三", 19);
        Students two = new Students("李四", 20);
        System.out.println(one.getName() + "今年" + one.getAge() + "岁，在" + Students.room + "教室，学号是：" + one.getId());
        System.out.println(two.getName() + "今年" + two.getAge() + "岁，在" + Students.room + "教室，学号是：" + two.getId());
        Students three = new Students("王五", 13);
        System.out.println(three.getName() + "今年" + three.getAge() + "岁，在" + Students.room + "教室，学号是：" + three.getId());
        //学号自动累加，且不可变
    }
}
